package com.scsj.supermarket.adapter;

import android.content.Context;
import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.scsj.supermarket.R;

import java.util.List;

/**
 * 商品评价类型
 */
public class GoodsCommTypeAdapter extends BaseQuickAdapter<String, BaseViewHolder> {
    private Context mContext;

    public GoodsCommTypeAdapter(Context mContext, List data) {
        super(R.layout.item_goods_comm_type, data);
        this.mContext = mContext;
    }

    @Override
    protected void convert(BaseViewHolder helper, String item) {
        helper.setText(R.id.name_tv, item);
        if (helper.getAdapterPosition() == 0) {
            helper.getView(R.id.img_iv).setVisibility(View.VISIBLE);
            helper.setBackgroundRes(R.id.background_ll, R.drawable.comm_type_selected_shape);
            helper.setTextColor(R.id.name_tv, mContext.getResources().getColor(R.color.price));
        } else {
            helper.getView(R.id.img_iv).setVisibility(View.GONE);
            helper.setBackgroundRes(R.id.background_ll, R.drawable.comm_type_unselected_shape);
            helper.setTextColor(R.id.name_tv, mContext.getResources().getColor(R.color.main_black_text));
        }
    }


}
